package cn.iocoder.yudao.module.wine.dal.mysql.supplytype;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.wine.dal.dataobject.supplytype.SupplyTypeDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.wine.controller.admin.supplytype.vo.*;

/**
 * 酒类类型 Mapper
 *
 * @author 管理员
 */
@Mapper
public interface SupplyTypeMapper extends BaseMapperX<SupplyTypeDO> {

    default PageResult<SupplyTypeDO> selectPage(SupplyTypePageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<SupplyTypeDO>()
                .eqIfPresent(SupplyTypeDO::getParentId, reqVO.getParentId())
                .likeIfPresent(SupplyTypeDO::getTypeName, reqVO.getTypeName())
                .eqIfPresent(SupplyTypeDO::getDepth, reqVO.getDepth())
                .eqIfPresent(SupplyTypeDO::getStatus, reqVO.getStatus())
                .eqIfPresent(SupplyTypeDO::getVisible, reqVO.getVisible())
                .eqIfPresent(SupplyTypeDO::getSort, reqVO.getSort())
                .betweenIfPresent(SupplyTypeDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(SupplyTypeDO::getId));
    }

}